<?php 
$requri = getenv ("REQUEST_URI");
$result=file_get_contents("http://images.habbo.es".$requri); 
if ($result === false) 
{
	// file located in [url=http://www.habbo.com]www.habbo.com[/url] ?
	$result=file_get_contents("http://www.habbo.es".$requri);
	if ($result === false) 
	{
		return; // not found in images.habbo.com and [url=http://www.habbo.com]www.habbo.com[/url]
	}
}
$dir_ = getenv("DOCUMENT_ROOT").$requri;
$dir = str_replace("\\", "/", $dir_);
$dir = substr($dir, 0, strrpos($dir, "/"));
mkdir($dir,0777,true);
$f = fopen($dir_,'w'); 
fwrite($f,$result,strlen($result)); 
fclose($f);
?>